<template>
  <div class="evaluationCriteria">
    <div>
      <div class="div">
        <p>是否对家长展示:</p>
        <p>
          <el-radio v-model="radio3" label="1">是</el-radio>
          <el-radio v-model="radio3" label="2">否</el-radio>
        </p>
      </div>
      <p>儿童营养评估标准</p>
      <el-table :data="tableData" border style="width: 65%">
        <el-table-column prop="standardDeviation" label="标准差法" align="center">
        </el-table-column>
        <el-table-column prop="name" label="估值标准" align="center">
          <el-table-column prop="ageWeight" label="年龄" align="center">
          </el-table-column>
          <el-table-column prop="ageHeight" label="身高" align="center">
          </el-table-column>
          <el-table-column prop="heightWeight" label="体重" align="center">
          </el-table-column>
          <el-table-column prop="ageBMI" label="BMI" align="center">
          </el-table-column>
          <el-table-column align="center" label="操作">
            <template slot-scope="scoped">
              <div>
                <el-button type="text" @click="editBtn(scoped.row.id)">修改</el-button>
              </div>
            </template>
          </el-table-column>
        </el-table-column>
      </el-table>

      <el-dialog title="修改标准差" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
        <div>
          <el-form :model="queryParams">
            <el-form-item label="年龄" prop="ageWeight">
              <el-input placeholder="请输入年龄" v-model="queryParams.ageWeight"></el-input>
            </el-form-item>
            <el-form-item label="身高" prop="ageHeight">
              <el-input placeholder="请输入身高" v-model="queryParams.ageHeight"></el-input>
            </el-form-item>
            <el-form-item label="体重" prop="heightWeight">
              <el-input placeholder="请输体重" v-model="queryParams.heightWeight"></el-input>
            </el-form-item>
          </el-form>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="sureBtn">确 定</el-button>
        </span>
      </el-dialog>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      radio: "1",
      radio1: "2",
      radio2: "2",
      radio3: "1",
      tableData: [
        {
          id:'1',
          standardDeviation: '≥+3 SD',
          ageWeight: '-',
          ageHeight: '-',
          heightWeight: '重度肥胖',
          ageBMI: '重度肥胖'
        },
        {
          id:'2',
          standardDeviation: '+2 SD≤·<+3 SD',
          ageWeight: '-',
          ageHeight: '-',
          heightWeight: '肥胖',
          ageBMI: '重度肥胖'
        },
        {
          id:'3',
          standardDeviation: '+1 SD≤·<+2 SD',
          ageWeight: '-',
          ageHeight: '-',
          heightWeight: '超重',
          ageBMI: '超重'
        },
        {
          id:'4',
          standardDeviation: '-1 SD≤·<+1 SD',
          ageWeight: '-',
          ageHeight: '-',
          heightWeight: '-',
          ageBMI: '-'
        },
        {
          id:'5',
          standardDeviation: '-2 SD≤·<-1 SD',
          ageWeight: '-',
          ageHeight: '-',
          heightWeight: '重度肥胖',
          ageBMI: '重度肥胖'
        },
        {
          id:'6',
          standardDeviation: '-3 SD≤·<-2 SD',
          ageWeight: '-',
          ageHeight: '-',
          heightWeight: '消瘦',
          ageBMI: '消瘦'
        },
        {
          id:'7',
          standardDeviation: '<-3 SD',
          ageWeight: '-',
          ageHeight: '-',
          heightWeight: '重度消瘦',
          ageBMI: '重度消瘦'
        },
      ],
      dialogVisible:false,
      queryParams:{},
      id:null
    };
  },
  components: {},
  computed: {},
  mounted() { },
  methods: {
    editBtn(id) {
      this.id = id
      const obj = {}
      this.tableData.forEach(item=>{
        if(item.id == id){
          obj.ageWeight = item.ageWeight
          obj.ageHeight = item.ageHeight
          obj.heightWeight = item.heightWeight
        }
      })
      this.queryParams = obj
      this.dialogVisible = true
    },
    sureBtn(){
      this.tableData.forEach(item=>{
        if(item.id == this.id){
          item.ageWeight = this.queryParams.ageWeight
          item.ageHeight = this.queryParams.ageHeight
          item.heightWeight = this.queryParams.heightWeight
        }
      })
      this.dialogVisible = false

    },
    handleClose(){
      this.dialogVisible = false
    }
  },
};
</script>

<style scoped lang="scss">
.evaluationCriteria {

  &>div {
    margin-left: 20px;

    .div {}
  }
}
</style>
